/*
 * @Author: humengchuan 531537052@qq.com
 * @Date: 2023-10-30 14:16:10
 * @LastEditors: humengchuan 531537052@qq.com
 * @LastEditTime: 2023-11-07 18:28:06
 * @FilePath: \projecte:\学习\react\my-react-project\src\router\index.tsx
 * @Description: 
 */

import React, { lazy } from 'react';
import { BrowserRouter, Routes, Route } from 'react-router-dom'

const Home = lazy(() => import('@/views/home/index'))
const Login = lazy(() => import('@/views/login'))
const About = lazy(() => import('@/views/about'))
const Mine = lazy(() => import('@/views/mine'))
const Notfound = lazy(() => import('@/views/404'))
const HomePage = lazy(() => import('@/views/home/homeContent'))

const router = () => (
    <BrowserRouter>
        <Routes>
            {/* 首页 */}
          <Route path='/' element={<Home />}>
            <Route path='' element={<HomePage />}></Route>
            <Route path='/about' element={<About />}></Route>
            <Route path='/mine' element={<Mine />}></Route>
          </Route>

          {/* login */}
          <Route path='/login' element={<Login />}></Route>

          {/* 404 */}
          <Route path='*' element={<Notfound />}></Route> 
        </Routes>
    </BrowserRouter>
)

export default router

// import React, { lazy } from 'react';
// import { createBrowserRouter } from "react-router-dom";
// import type { RouteObject } from "react-router-dom";
// const App = lazy(() => import('@/App'))
// const Home = lazy(() => import('@/views/home'))
// const Menu = lazy(() => import('@/views/menu'))
// const About = lazy(() => import('@/views/about'))
// const Mine = lazy(() => import('@/views/mine'))

// const routes: RouteObject[] = [
//     {
//         path: '/',
//         element: React.createElement(App),
//         children: [
//             {
//                 path: 'Menu',
//                 element: React.createElement(Menu) 
//             },
//             {
//                 path: 'home',
//                 element: React.createElement(Home) 
//             },
//             {
//                 path: 'about',
//                 element: React.createElement(About)
//             },
//             {
//                 path: 'mine',
//                 element: React.createElement(Mine)
//             }
//         ]
//     },
//     {
        
//     }
    
// ]

// const baseRouter = createBrowserRouter(routes)

// export default baseRouter

